<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:include="~{common/header :: commonHead}">
    <title>商铺详情</title>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5 th:text="${title}"></h5>
                    <div class="ibox-tools">
                    </div>
                </div>
                <div class="ibox-content">
                    <div style="width: 70%">
                        <div class="well">
                            <div class="row">
                                <form class="form-body form-horizontal m-t" id="label-group-form">
                                    <div class="row form-group draggable ui-draggable dropped">
                                        <label class="col-sm-3 control-label">规则名称：</label>
                                        <div class="col-sm-6" style="display: flex">
                                            <div>
                                                <input type="hidden" name="id">
                                                <input type="hidden" name="belonging" th:value="${sysUser.id}">
                                                <input class="form-control" type="text" value="" name="name">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row form-group draggable ui-draggable dropped">
                                        <label class="col-sm-3 control-label">作者：</label>
                                        <div class="col-sm-6" style="display: flex">
                                            <div>
                                                <input class="form-control" type="text" value="" name="author">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row form-group draggable ui-draggable dropped">
                                        <label class="col-sm-3 control-label">使用场景：</label>
                                        <div class="col-sm-6" style="display: flex">
                                            <div>
                                                <input class="form-control" type="text" value="" name="scene">
                                            </div>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <div class="well">
                            <h3>会员</h3>
                            <div style="float: right; margin-top: -20px">
<!--                                <div class="onoffswitch">-->
<!--                                    <input type="checkbox" checked="checked" class="onoffswitch-checkbox" id="user-switch">-->
<!--                                    <label class="onoffswitch-label" for="user-switch">-->
<!--                                        <span class="onoffswitch-inner"></span>-->
<!--                                        <span class="onoffswitch-switch"></span>-->
<!--                                    </label>-->
<!--                                </div>-->
                            </div>
                            <div class="row">
                                <form class="form-body form-horizontal m-t label-form"
                                      id="label-form-member-freeze">
                                    <div class="row form-group draggable ui-draggable dropped">
                                        <label class="col-sm-3 control-label">会员状态：</label>
                                        <div class="col-sm-6" style="margin-top: 6px;">
                                            <input type="radio" value="" name="option" checked>全部
                                            <input type="radio" value="0" name="option">正常
                                            <input type="radio" value="1" name="option">冻结
                                            <input type="hidden" name="id">
                                            <input type="hidden" th:value="${sysUser.id}"
                                                   name="belonging">
                                            <input type="hidden" value="会员状态" name="labelName">
                                            <input type="hidden" value="会员冻结状态标签" name="labelDesc">
                                            <input type="hidden" value="member" name="labelFrom">
                                            <input type="hidden" value="oo_user" name="tableName">
                                            <input type="hidden" value="Integer" name="fieldType">
                                            <input type="hidden" value="POINT" name="optionType">
                                            <input type="hidden" value="freeze" name="fieldName">
                                            <!--<button class="btn btn-xs btn-primary" type="button" onclick="checkNum($(this))">
                                                测试
                                            </button>-->
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="row">
                                <form class="form-body form-horizontal m-t label-form"
                                      id="label-form-member-gender">
                                    <div class="row form-group draggable ui-draggable dropped">
                                        <label class="col-sm-3 control-label">会员性别：</label>
                                        <div class="col-sm-6" style="margin-top: 6px;">
                                            <input type="hidden" name="id">
                                            <input type="radio" value="" name="option" checked>全部
                                            <input type="radio" value="1" name="option">男
                                            <input type="radio" value="2" name="option">女
                                            <input type="radio" value="0" name="option">保密
                                            <input type="hidden" th:value="${sysUser.id}"
                                                   name="belonging">
                                            <input type="hidden" value="member" name="labelFrom">
                                            <input type="hidden" value="oo_user" name="tableName">
                                            <input type="hidden" value="Integer" name="fieldType">
                                            <input type="hidden" value="POINT" name="optionType">
                                            <input type="hidden" value="gender" name="fieldName">
                                            <!--<button class="btn btn-xs btn-primary" type="button" onclick="checkNum($(this))">
                                                测试
                                            </button>-->
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="row">
                                <form class="form-body form-horizontal m-t label-form"
                                      id="label-form-member-age">
                                    <div class="row form-group draggable ui-draggable dropped">
                                        <label class="col-sm-3 control-label">会员年龄：</label>
                                        <div class="col-sm-6" style="margin-top: 6px;">
                                            <input type="hidden" name="id">
                                            <input type="radio" value="" name="option" checked>全部
                                            <input type="radio" value="0~25" name="option">25岁以下
                                            <input type="radio" value="26~40" name="option">26-40
                                            <input type="radio" value="41~55" name="option">41-55
                                            <input type="radio" value="55~100" name="option">55岁以上
                                            <input type="hidden" th:value="${sysUser.id}"
                                                   name="belonging">
                                            <input type="hidden" value="oo_user" name="tableName">
                                            <input type="hidden" value="member" name="labelFrom">
                                            <input type="hidden" value="Integer" name="fieldType">
                                            <input type="hidden" value="RANGE" name="optionType">
                                            <input type="hidden" value="age" name="fieldName">
                                            <!--<button class="btn btn-xs btn-primary" type="button" onclick="checkNum($(this))">
                                                测试
                                            </button>-->
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="row">
                                <form class="form-body form-horizontal m-t label-form"
                                      id="label-form-member-married">
                                    <div class="row form-group draggable ui-draggable dropped">
                                        <label class="col-sm-3 control-label">婚姻状态：</label>
                                        <div class="col-sm-6" style="margin-top: 6px;">
                                            <input type="hidden" name="id">
                                            <input type="radio" value="" name="option" checked>全部
                                            <input type="radio" value="0" name="option">单身
                                            <input type="radio" value="1" name="option">已婚
                                            <input type="hidden" th:value="${sysUser.id}"
                                                   name="belonging">
                                            <input type="hidden" value="oo_user" name="tableName">
                                            <input type="hidden" value="member" name="labelFrom">
                                            <input type="hidden" value="Integer" name="fieldType">
                                            <input type="hidden" value="POINT" name="optionType">
                                            <input type="hidden" value="married" name="fieldName">
                                            <!--<button class="btn btn-xs btn-primary" type="button" onclick="checkNum($(this))">
                                                测试
                                            </button>-->
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="row">
                                <form class="form-body form-horizontal m-t label-form"
                                      id="label-form-member-children">
                                    <div class="row form-group draggable ui-draggable dropped">
                                        <label class="col-sm-3 control-label">有无子女：</label>
                                        <div class="col-sm-6" style="margin-top: 6px;">
                                            <input type="hidden" name="id">
                                            <input type="radio" value="" name="option" checked>全部
                                            <input type="radio" value="1" name="option">有
                                            <input type="radio" value="0" name="option">无
                                            <input type="hidden" th:value="${sysUser.id}"
                                                   name="belonging">
                                            <input type="hidden" value="oo_user" name="tableName">
                                            <input type="hidden" value="member" name="labelFrom">
                                            <input type="hidden" value="Integer" name="fieldType">
                                            <input type="hidden" value="POINT" name="optionType">
                                            <input type="hidden" value="children" name="fieldName">
                                            <!--<button class="btn btn-xs btn-primary" type="button" onclick="checkNum($(this))">
                                                测试
                                            </button>-->
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="row">
                                <form class="form-body form-horizontal m-t label-form"
                                      id="label-form-member-update_time">
                                    <div class="row form-group draggable ui-draggable dropped">
                                        <label class="col-sm-3 control-label">活跃用户：</label>
                                        <div class="col-sm-6" style="margin-top: 6px;">
                                            <input type="hidden" name="id">
                                            <input type="radio" value="" name="option" checked>全部
                                            <input type="radio" value="WEEK" name="option">一周
                                            <input type="radio" value="MONTH" name="option">一月
                                            <input type="radio" value="QUARTER" name="option">一季
                                            <input type="hidden" th:value="${sysUser.id}"
                                                   name="belonging">
                                            <input type="hidden" value="oo_user" name="tableName">
                                            <input type="hidden" value="member" name="labelFrom">
                                            <input type="hidden" value="Date" name="fieldType">
                                            <input type="hidden" value="SPAN" name="optionType">
                                            <input type="hidden" value="update_time"
                                                   name="fieldName">
                                            <!--<button class="btn btn-xs btn-primary" type="button" onclick="checkNum($(this))">
                                                测试
                                            </button>-->
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="row">
                                <form class="form-body form-horizontal m-t label-form"
                                      id="label-form-member-create_time">
                                    <div class="row form-group draggable ui-draggable dropped">
                                        <label class="col-sm-3 control-label">注册时间：</label>
                                        <div class="col-sm-6" style="margin-top: 6px;">
                                            <input type="hidden" name="id">
                                            <input type="radio" value="" name="option" checked>全部
                                            <input type="radio" value="WEEK" name="option">一周
                                            <input type="radio" value="MONTH" name="option">一月
                                            <input type="radio" value="QUARTER" name="option">一季
                                            <input type="radio" value="YEAR" name="option">一年
                                            <input type="hidden" th:value="${sysUser.id}"
                                                   name="belonging">
                                            <input type="hidden" value="oo_user" name="tableName">
                                            <input type="hidden" value="member" name="labelFrom">
                                            <input type="hidden" value="Date" name="fieldType">
                                            <input type="hidden" value="SPAN" name="optionType">
                                            <input type="hidden" value="create_time"
                                                   name="fieldName">
                                            <!--<button class="btn btn-xs btn-primary" type="button" onclick="checkNum($(this))">
                                                测试
                                            </button>-->
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <div class="well consume_well">
                            <h3>消费</h3>
                            <div style="float: right; margin-top: -20px">
                                <div class="onoffswitch">
                                    <input type="checkbox" checked="checked" class="onoffswitch-checkbox" id="consume-switch">
                                    <label class="onoffswitch-label" for="consume-switch">
                                        <span class="onoffswitch-inner"></span>
                                        <span class="onoffswitch-switch"></span>
                                    </label>
                                </div>
                            </div>
                            <div class="row">
                                <form class="form-body form-horizontal m-t label-form"
                                      id="label-form-consume-cosume_day">
                                    <div class="row form-group draggable ui-draggable dropped">
                                        <label class="col-sm-3 control-label">时间区间：</label>
                                        <div class="col-sm-6" style="margin-top: 6px;">
                                            <input type="hidden" name="id">
                                            <div class="layui-form-item">
                                                <div class="layui-inline" >
                                                    <div class="layui-input-inline" style="width: 350px;">
                                                        <input type="text" name="option" readonly class="layui-input" id="cosume_day" placeholder=" ~ ">
                                                    </div>
                                                </div>
                                            </div>
                                            <input type="hidden" th:value="${sysUser.id}"
                                                   name="belonging">
                                            <input type="hidden" value="oo_consumption_amount"
                                                   name="tableName">
                                            <input type="hidden" value="consume" name="labelFrom">
                                            <input type="hidden" value="Date" name="fieldType">
                                            <input type="hidden" value="RANGE" name="optionType">
                                            <input type="hidden" value="cosume_day" name="fieldName">
                                            <!--<button class="btn btn-xs btn-primary" type="button" onclick="checkNum($(this))">
                                                测试
                                            </button>-->
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="row">
                                <form class="form-body form-horizontal m-t label-form"
                                      id="label-form-consume-count">
                                    <div class="row form-group draggable ui-draggable dropped">
                                        <label class="col-sm-3 control-label">消费次数：</label>
                                        <div class="col-sm-6" style="margin-top: 6px;">
                                            <input type="hidden" name="id">
                                            <div class="layui-form-item">
                                                <div class="layui-inline">
                                                    <div class="layui-input-inline" style="width: 100px;">
                                                        <input type="number" name="option" class="layui-input">
                                                    </div>
                                                    <div class="layui-form-mid">~</div>
                                                    <div class="layui-input-inline" style="width: 100px;">
                                                        <input type="number" name="option" class="layui-input">
                                                    </div>
                                                </div>
                                            </div>
                                            <input type="hidden" th:value="${sysUser.id}"
                                                   name="belonging">
                                            <input type="hidden" value="oo_consumption_amount"
                                                   name="tableName">
                                            <input type="hidden" value="consume" name="labelFrom">
                                            <input type="hidden" value="Integer" name="fieldType">
                                            <input type="hidden" value="RANGE" name="optionType">
                                            <input type="hidden" value="COUNT" name="statisticType">
                                            <input type="hidden" value="count" name="fieldName">
                                            <!--<button class="btn btn-xs btn-primary" type="button" onclick="checkNum($(this))">
                                                测试
                                            </button>-->
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <div class="well integral_well">
                            <h3>积分</h3>
                            <div style="float: right; margin-top: -20px">
                                <div class="onoffswitch">
                                    <input type="checkbox" checked="checked" class="onoffswitch-checkbox" id="integral-switch">
                                    <label class="onoffswitch-label" for="integral-switch">
                                        <span class="onoffswitch-inner"></span>
                                        <span class="onoffswitch-switch"></span>
                                    </label>
                                </div>
                            </div>
                            <div class="row">
                                <form class="form-body form-horizontal m-t label-form"
                                      id="label-form-integral-create_time">
                                    <div class="row form-group draggable ui-draggable dropped">
                                        <label class="col-sm-3 control-label">时间区间：</label>
                                        <div class="col-sm-6" style="margin-top: 6px;">
                                            <input type="hidden" name="id">
                                            <div class="layui-form-item">
                                                <div class="layui-inline" >
                                                    <div class="layui-input-inline" style="width: 350px;">
                                                        <input type="text" name="option" readonly class="layui-input" id="integral_time" placeholder=" ~ ">
                                                    </div>
                                                </div>
                                            </div>
                                            <input type="hidden" th:value="${sysUser.id}"
                                                   name="belonging">
                                            <input type="hidden" value="oo_integral_trading_details"
                                                   name="tableName">
                                            <input type="hidden" value="integral" name="labelFrom">
                                            <input type="hidden" value="Date" name="fieldType">
                                            <input type="hidden" value="RANGE" name="optionType">
                                            <input type="hidden" value="GET" name="centType">
                                            <input type="hidden" value="create_time" name="fieldName">
                                            <!--<button class="btn btn-xs btn-primary" type="button" onclick="checkNum($(this))">
                                                测试
                                            </button>-->
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="row">
                                <form class="form-body form-horizontal m-t label-form"
                                      id="label-form-integral-sum">
                                    <div class="row form-group draggable ui-draggable dropped">
                                        <label class="col-sm-3 control-label">获得积分：</label>
                                        <div class="col-sm-6" style="margin-top: 6px;">
                                            <input type="hidden" name="id">
                                            <div class="layui-form-item">
                                                <div class="layui-inline">
                                                    <div class="layui-input-inline" style="width: 100px;">
                                                        <input type="number" name="option" class="layui-input">
                                                    </div>
                                                    <div class="layui-form-mid">~</div>
                                                    <div class="layui-input-inline" style="width: 100px;">
                                                        <input type="number" name="option" class="layui-input">
                                                    </div>
                                                </div>
                                            </div>
                                            <input type="hidden" th:value="${sysUser.id}"
                                                   name="belonging">
                                            <input type="hidden" value="oo_integral_trading_details"
                                                   name="tableName">
                                            <input type="hidden" value="integral" name="labelFrom">
                                            <input type="hidden" value="Integer" name="fieldType">
                                            <input type="hidden" value="RANGE" name="optionType">
                                            <input type="hidden" value="SUM" name="statisticType">
                                            <input type="hidden" value="GET" name="centType">
                                            <input type="hidden" value="sum" name="fieldName">
                                            <!--<button class="btn btn-xs btn-primary" type="button" onclick="checkNum($(this))">
                                                测试
                                            </button>-->
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <div class="well park_well">
                            <h3>停车</h3>
                            <div style="float: right; margin-top: -20px">
                                <div class="onoffswitch">
                                    <input type="checkbox" checked="checked" class="onoffswitch-checkbox" id="park-switch">
                                    <label class="onoffswitch-label" for="park-switch">
                                        <span class="onoffswitch-inner"></span>
                                        <span class="onoffswitch-switch"></span>
                                    </label>
                                </div>
                            </div>
                            <div class="row">
                                <form class="form-body form-horizontal m-t label-form"
                                      id="label-form-park-pay_time">
                                    <div class="row form-group draggable ui-draggable dropped">
                                        <label class="col-sm-3 control-label">时间区间：</label>
                                        <div class="col-sm-6" style="margin-top: 6px;">
                                            <input type="hidden" name="id">
                                            <div class="layui-form-item">
                                                <div class="layui-inline" >
                                                    <div class="layui-input-inline" style="width: 350px;">
                                                        <input type="text" name="option" readonly class="layui-input" id="park_time" placeholder=" ~ ">
                                                    </div>
                                                </div>
                                            </div>
                                            <input type="hidden" th:value="${sysUser.id}"
                                                   name="belonging">
                                            <input type="hidden" value="oo_parking_record"
                                                   name="tableName">
                                            <input type="hidden" value="park" name="labelFrom">
                                            <input type="hidden" value="Date" name="fieldType">
                                            <input type="hidden" value="RANGE" name="optionType">
                                            <input type="hidden" value="pay_time" name="fieldName">
                                            <!--<button class="btn btn-xs btn-primary" type="button" onclick="checkNum($(this))">
                                                测试
                                            </button>-->
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="row">
                                <form class="form-body form-horizontal m-t label-form"
                                      id="label-form-park-count">
                                    <div class="row form-group draggable ui-draggable dropped">
                                        <label class="col-sm-3 control-label">停车次数：</label>
                                        <div class="col-sm-6" style="margin-top: 6px;">
                                            <input type="hidden" name="id">
                                            <div class="layui-form-item">
                                                <div class="layui-inline">
                                                    <div class="layui-input-inline" style="width: 100px;">
                                                        <input type="number" name="option" class="layui-input">
                                                    </div>
                                                    <div class="layui-form-mid">~</div>
                                                    <div class="layui-input-inline" style="width: 100px;">
                                                        <input type="number" name="option" class="layui-input">
                                                    </div>
                                                </div>
                                            </div>
                                            <input type="hidden" th:value="${sysUser.id}"
                                                   name="belonging">
                                            <input type="hidden" value="oo_parking_record"
                                                   name="tableName">
                                            <input type="hidden" value="park" name="labelFrom">
                                            <input type="hidden" value="Integer" name="fieldType">
                                            <input type="hidden" value="RANGE" name="optionType">
                                            <input type="hidden" value="COUNT" name="statisticType">
                                            <input type="hidden" value="count" name="fieldName">
                                            <!--<button class="btn btn-xs btn-primary" type="button" onclick="checkNum($(this))">
                                                测试
                                            </button>-->
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <div style="margin-left: 20px">
                            <div>
                                <button class="btn btn-primary" type="button" onclick="submitAll();">保存</button>
                                <button class="btn btn-primary" type="button" onclick="testLabelGroup();">预览</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script th:inline="javascript">

    let type = [[${type}]];

    function checkNum(e) {
        var serialize = e.parent().parent().parent().serializeJson();
        $.ajax({
            url: ipDomain + '/quanquan-user/memberLabel/count',
            contentType: 'application/json; charset=utf-8',
            data: serialize,
            dataType: 'JSON',
            type: 'POST',
            success: function (res) {
                alert('包含人数：' + res.data);
            }
        });
    }

    function testLabelGroup() {
        let list = new Array();
        $('.label-form').each((i, e) => {

            var json2Object = $(e).serializeJson2Obj();
            if(jQuery.isArray(json2Object.option)){
                json2Object['option'] = json2Object.option[0]+"~"+json2Object.option[1];
            }

            list.push(json2Object);
        });
        $.ajax({
            url: ipDomain + '/quanquan-user/memberLabel/countAll',
            contentType: 'application/json; charset=utf-8',
            data: JSON.stringify(list),
            dataType: 'JSON',
            type: 'POST',
            success: function (res) {
                alert('包含人数：' + res.data);
            }
        });
    }

    function submitAll() {
        console.log(type)

        let groupData = $('#label-group-form').serializeJson2Obj();
        if (groupData['name'] == null || groupData['name'] == '') {
            layer.msg('规则名称不能为空', {time: 500});
            return;
        }
        let labels = new Array();
        $('.label-form').each((i, e) => {
            var json2Object = $(e).serializeJson2Obj();
            if(jQuery.isArray(json2Object.option)){
                json2Object['option'] = json2Object.option[0]+"~"+json2Object.option[1];
            }

            labels.push(json2Object);
        });
        if (labels == null || labels.length == 0) {
            layer.msg('子标签不能为空', {time: 500});
            return;
        }
        groupData['labels'] = labels;

        let url = ipDomain + (type == 'add' ? '/quanquan-user/labelGroup/create' : '/quanquan-user/labelGroup/update');
        $.ajax({
            url: url,
            contentType: 'application/json; charset=utf-8',
            data: JSON.stringify(groupData),
            dataType: 'JSON',
            type: 'POST',
            success: function (res) {
                if (res.resCode == 0) {
                    window.location.href = '/userLabel/list';
                } else {
                    layer.msg(res.resMsg, {icon: 11, time: 10})
                }
            }
        });
    }

    if (type == 'edit') {
        initForm();
    }

    function initForm() {
        let params = getRequestParams(), id = params[1].value, formData;
        if (params.length != 0 && params.length > 1) {
            $.get(ipDomain + '/quanquan-user/labelGroup/get/' + id, (res) => {
                    formData = res.data;
                    $("#label-group-form").loadData(formData);
                    let formArr = formData.labels;
                    formArr.forEach((e) => {
                        let form = $('#label-form-' +e.labelFrom + '-' + e.fieldName);
                        form.find("input[name='id']").val(e.id);
                        let options = form.find("input[name='option']");
                        options.each((i, o) => {
                            if($(o).attr('type') == "radio"){
                                if ($(o).val() == e.option) {
                                    $(o).attr('checked', true);
                                } else {
                                    $(o).removeAttr('checked');
                                }
                            }else if($(o).attr('type') == "text"){
                                $(o).val(e.option);
                            }else if($(o).attr('type') == "number"){
                                if(i == 0){
                                    $(o).val(e.leftValue);
                                }else{
                                    $(o).val(e.rightValue);
                                }
                            }
                        });
                    });
                }
            );
        }
    }

    $("#consume-switch").click(function () {

        var checked = document.getElementById("consume-switch").checked;
        if(checked){
            $(".consume_well .row").show();
        }else{
            $(".consume_well .row input[name='option']").val("");
            $(".consume_well .row").hide();
        }

    });
    $("#integral-switch").click(function () {

        var checked = document.getElementById("integral-switch").checked;
        if(checked){
            $(".integral_well .row").show();
        }else{
            $(".integral_well .row input[name='option']").val("");
            $(".integral_well .row").hide();
        }

    });
    $("#park-switch").click(function () {

        var checked = document.getElementById("park-switch").checked;
        if(checked){
            $(".park_well .row").show();
        }else{
            $(".park_well .row input[name='option']").val("");
            $(".park_well .row").hide();
        }

    });

    layui.use('laydate', function() {
        var laydate = layui.laydate;
        laydate.render({
            elem: '#integral_time'
            ,type: 'datetime'
            ,range: "~"
        });
        laydate.render({
            elem: '#park_time'
            ,type: 'datetime'
            ,range: "~"
        });
        laydate.render({
            elem: '#cosume_day'
            ,type: 'date'
            ,format:"yyyy-MM-dd HH:mm:ss"
            ,range: "~"
        });
    });
</script>
</html>